package com.darkness.rpc.test.provider;

import com.darkness.api.TestItf;
import com.darkness.rpc.framework.provider.RpcProvider;
import com.darkness.rpc.framework.provider.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author darkness
 * @time 2022/4/15 9:22
 * @description
 */
public class ProviderMain {

    public static void main(String[] args) {
        Service httpService1 = new Service("httpGroup", "1.0.1", TestItf.class, TestItfImplHttp1.class);
        Service httpService2 = new Service("httpGroup", "1.0.2", TestItf.class, TestItfImplHttp1.class);
        List<Service> httpServices = new ArrayList<>();
        httpServices.add(httpService1);
        httpServices.add(httpService2);
        Service darkService1 = new Service("darkGroup", "1.0.1", TestItf.class, TestItfImplDark1.class);
        Service darkService2 = new Service("darkGroup", "1.0.2", TestItf.class, TestItfImplDark2.class);
        List<Service> darkServices = new ArrayList<>();
        darkServices.add(darkService1);
        darkServices.add(darkService2);
        Map<String, List<Service>> servicesMap = new HashMap<>();
        servicesMap.put("http", httpServices);
        servicesMap.put("dark", darkServices);
        RpcProvider provider = new RpcProvider(servicesMap);
        provider.startProvider("file", 9955);
    }

}
